home *** CD-ROM | disk | FTP | other *** search
- property x, y, kTopLimit, kBottomLimit, kLeftLimit, kRightLimit
- global gBallSpeed, gPaused
-
- on beginSprite me
- gameBoardS = 20
- velocityList = [-1.0, -0.5, 0.5, 1.0]
- me.x = getAt(velocityList, random(count(velocityList)))
- me.y = abs(getAt(velocityList, random(count(velocityList))))
- me.kTopLimit = sprite(gameBoardS).top
- me.kBottomLimit = sprite(gameBoardS).bottom
- me.kLeftLimit = sprite(gameBoardS).left
- me.kRightLimit = sprite(gameBoardS).right
- end
-
- on exitFrame me
- if gPaused = 0 then
- moveBall(me)
- end if
- end
-
- on moveBall me
- sprite(me.spriteNum).loc = sprite(me.spriteNum).loc + (point(x, y) * gBallSpeed)
- checkBounds(me)
- end
-
- on checkBounds me
- if ((sprite(me.spriteNum).right >= me.kRightLimit) and (x > 0)) or ((sprite(me.spriteNum).left <= me.kLeftLimit) and (x < 0)) then
- bounce(me, #leftright)
- end if
- if (sprite(me.spriteNum).top <= me.kTopLimit) and (y < 0) then
- bounce(me, #updown)
- else
- if (sprite(me.spriteNum).bottom >= me.kBottomLimit) and (y > 0) then
- sprite(me.spriteNum).member = member("BAll Explode Loop")
- puppetSound("shot")
- updateStage()
- repeat while soundBusy(1)
- updateStage()
- end repeat
- launchBall()
- end if
- end if
- end
-
- on bounce me, direction
- paddleS = 43
- paddleQuad = sprite(paddleS).width / 4
- if listp(direction) then
- collisionS = getAt(direction, 1)
- if the locH of sprite me.spriteNum < the locH of sprite collisionS then
- direction = #rickecheLeft
- else
- direction = #rickecheRight
- end if
- if collisionS > paddleS then
- exit
- end if
- if collisionS <= 20 then
- exit
- end if
- if sprite(collisionS).member.name = "Exploiding Brick Loop" then
- exit
- end if
- end if
- puppetSound("Jug")
- case direction of
- #updown:
- me.y = me.y * -1
- #leftright:
- me.x = me.x * -1
- #rickecheLeft:
- if me.x > 0 then
- me.x = me.x * -1
- end if
- me.y = me.y * -1
- if collisionS = paddleS then
- animateBall(me)
- if the locH of sprite me.spriteNum < (sprite(paddleS).left + (paddleQuad * 1)) then
- me.x = me.x + 0.5
- else
- me.x = me.x - 0.5
- end if
- exit
- end if
- removeBrick(me, collisionS)
- #rickecheRight:
- me.x = abs(me.x)
- me.y = me.y * -1
- if collisionS = paddleS then
- animateBall(me)
- if the locH of sprite me.spriteNum < (sprite(paddleS).left + (paddleQuad * 3)) then
- me.x = me.x - 0.5
- else
- me.x = me.x + 0.5
- end if
- exit
- end if
- removeBrick(me, collisionS)
- otherwise:
- me.y = me.y * -1
- me.x = me.x * -1
- end case
- end
-
- on removeBrick me, brickS
- global gBrickMax, gBrickNum
- sprite(brickS).member = member("Exploiding Brick Loop")
- gBallSpeed = gBallSpeed + 0.5
- gBrickNum = gBrickNum + 1
- end
-
- on animateBall me
- puppetSound("Paddle")
- end
-